package com.study.ssm.controller;

import com.study.ssm.entity.User;
import com.study.ssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhoujunlin
 * @date 2023年08月01日 17:52
 * @desc
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @ResponseBody
    @GetMapping("add")
    public String add(@RequestParam String username, @RequestParam String password) {
        userService.save(new User(username, password));
        return "success";
    }

}
